package net.esj.basic.core.engine.tools.exec.inst;

import java.io.IOException;
import java.io.InputStream;

import net.esj.basic.core.engine.tools.exec.Exec;

import org.springframework.util.Assert;

public abstract class AbstractExec implements Exec {

	@Override
	public InputStream execute(String... args) throws IOException{
		Assert.notNull(args);
		StringBuilder sb = new StringBuilder();
		sb.append(getCommand());
		for(String str : args){
			sb.append(" "+str);
		}
		Process process;
		process = Runtime.getRuntime().exec(sb.toString());
		return process.getInputStream();
	}

}
